<?php
namespace app\admin\controller;
use think\Loader;
class Front extends Base{

    //法律文书
    public function writ_list(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->writList();
        $this->assign('list', $data['list']);
        $this->assign('page', $data['page']);
        return  $this->fetch();
    }

    //法律文书新增与编辑（页面）
    public function writ_any(){
        $writ_id = input('writ_id');
        $data    = null;
        $invoking     = Loader::model('Front','service');
        if(empty($writ_id)){
            $title = '新增文书';
        }else{
            $title = '编辑文书';
            $data  = $invoking->writFind();
        }
        $type_list         = $invoking->writType();
        $this->assign('title', $title);
        $this->assign('data', $data);
        $this->assign('type_list', $type_list);
        return  $this->fetch();
    }

    //文书类型
    public function writ_type(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->frontTypeList();
        $this->assign('list', $data['list']);
        $this->assign('page', $data['page']);
        return $this->fetch();
    }

    //文书编辑查询
    public function writTypeFind(){
        $writ_type_id = input('writ_type_id');
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->writTypeFind($writ_type_id);
        return json($data);
    }

    //律师展示
    public function lawyer_list(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->lawyerList();
        $this->assign('list', $data['list']);
        $this->assign('page', $data['page']);
        return  $this->fetch();
    }

    //律师展示新增与编辑
    public function lawyer_any(){
        $lawyer_id = input('lawyer_id');
        $data    = null;
        $invoking     = Loader::model('Front','service');
        if(empty($lawyer_id)){
            $title = '新增律师';
        }else{
            $title = '编辑律师';
            $data  = $invoking->lawyerFind($lawyer_id);
        }
        $this->assign('title', $title);
        $this->assign('data', $data);
        return  $this->fetch();
    }


    //轮播图
    public function slideshow_list(){
        $invoking         = Loader::model('Front','service');
        $data             = $invoking->slideshowList();
        $count         =count($data);
        $this->assign('count',$count);
        $this->assign('list',$data);
        return $this->fetch();
    }


    //咨讯类型
    public function news_type(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->newsTypeList();
        $this->assign('list', $data['list']);
        $this->assign('page', $data['page']);
        return $this->fetch();
    }

    //咨讯类型查询
    public function newsTypeFind(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->newsTypeFind();
        return json($data);
    }

    //咨讯列表
    public function news_list(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->newsList();
        $this->assign('list', $data['list']);
        $this->assign('page', $data['page']);
        return  $this->fetch();
    }

    //咨询新增与编辑
    public function news_any(){

        $news_id = input('news_id');
        $data    = '';
        $invoking     = Loader::model('Front','service');
        if($news_id){
            $title = '咨讯编辑';
            $data  = $invoking->newsFind($news_id);
        }else{
            $title = '咨讯新增';
        }
        $list         = $invoking->newsTypeSelect();
        $this->assign('list',$list);
        $this->assign('title',$title);
        $this->assign('data',$data);
        return $this->fetch();
    }

    //顾问卡
    public function counselor_list(){
        $invoking     = Loader::model('Front','service');
        $data         = $invoking->counselorList();
        $this->assign('list', $data['list']);
        $this->assign('page', $data['page']);
        return $this->fetch();
    }

    //顾问卡新增与编辑
    public function counselor_any(){
        $counselor_id = input('counselor_id');
        $data    = '';
        $invoking     = Loader::model('Front','service');
        if($counselor_id){
            $title = '顾问卡编辑';
            $data  = $invoking->counselorFind($counselor_id);
        }else{
            $title = '顾问卡新增';
        }
        $this->assign('title',$title);
        $this->assign('data',$data);
        return $this->fetch();
    }
}
